const { required } = require("@hapi/joi");
const express = require("express")
const cate_hander = require("../router_handler/artcate");
const expressJoi = require('@escook/express-joi')

const router = express.Router()
const {add_cate_schema,Id_schema,updata_cate_schema} = require('../sechema/artcate')

//获取文章分类列表
router.get('/cates',cate_hander.getArticleCates)

//添加文章分类
router.post("/addcates",expressJoi(add_cate_schema),cate_hander.addArticleCates)

//删除文章分类
router.get("/deletecate/:id",expressJoi(Id_schema),cate_hander.deleteCateById)

//根据id获取文章分类
router.get('/cates/:id', expressJoi(Id_schema),cate_hander.getArtCateById)

//根据id更新文章分类数据
router.post('/updatecate', expressJoi(updata_cate_schema), cate_hander.updateCateById)
module.exports = router